# -*- coding: utf-8 -*-#
#-------------------------------------------------------------------------------
# 建立者:        潘炎珍
# Name:         demo01
# Description:
# Author:       98745
# Date:         2019/3/9
#-------------------------------------------------------------------------------

# f=open('./test1.txt','w')
# print(f.write('i love '))
# print(f.write('python'))
# f.close()

# f=open('./test1.txt','r')
# print(f.read(7))
# print(f.read(6))
# f.close()
# try:
#     f=open('./text.txt','r+')
# except Exception as e:
#     print(e)

# f=open('./test2.txt','a+')
# print(f.write('hello'))
# f.close()

# f=open('./test2.txt','a+')
# print(f.read())
# f.seek(0)
# print(f.read())
# f.close()
try:
    f=open('./test2.txt','w+')
    print(f.read())
    f.write('how are you')
    f.seek(0)
    print(f.read())
finally:
    f.close()